package main

import (
	"fmt"
	"gorm-study/src/pkg/student/models"
	"gorm-study/src/pkg/utils/dbutil"
)

func main() {
	newEmail := "zhang333@163.com"
	dbutil.DB.Model(&models.Student{}).Where("name = ?", "张三").Updates(map[string]any{
		"age":   19,
		"email": &newEmail,
	})

	var student models.Student
	dbutil.DB.Where("name = ?", "张三").First(&student)
	fmt.Printf("Name:%v, Age:%v, Email:%v \n", student.Name, student.Age, *student.Email)
}
